<template>
  <div
    :style="{ width: width || '100%', height: height || '100%' }"
    v-loading="loading"
    element-loading-background="white"
  >
    <iframe ref="iframe" :src="src" frameborder="no" style="width: 100%; height: 100%" scrolling="auto"></iframe>
  </div>
</template>

<script>
export default {
  props: {
    src: {
      type: String,
      required: true,
    },
    width: {
      type: String,
      required: false,
    },
    height: {
      type: String,
      required: false,
    },
  },
  data() {
    return {
      loading: true,
    }
  },
  mounted() {
    this.$refs.iframe.onload = () => {
      this.loading = false
    }
  },
}
</script>

<style lang="scss" scoped></style>
